
import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:get/get_core/src/get_main.dart';
import 'package:qianyi/entity/home/recommend/Category.dart';
import 'package:qianyi/entity/home/trendVo.dart';
import 'package:qianyi/network/http_entity.dart';
import 'package:qianyi/state/token.dart';
import 'package:shared_preferences/shared_preferences.dart';

import '../../../entity/home/recommend/Record.dart';
import '../../../network/base_entity.dart';
import '../../../network/http_config.dart';
import '../../../network/http_manager.dart';
import '../../../ui/widget/custom_refresh_mixin.dart';



class RecommendCategoryModel extends ChangeNotifier with CustomRefreshMixin {
  TokenController tokenController = Get.find();
  TabController? tabController;
  Records? r1;
  Records? r2;


  @override
  Future<List> requestList(int page) async {
    SharedPreferences prefs = await SharedPreferences.getInstance();
    Map<String,dynamic> userInfo = jsonDecode(prefs.getString("userInfo")!);


    Map<String, dynamic> params = {};
    params["uid"] = await tokenController.getUid();

    IBaseEntity? result = await HttpManager.getInstance().request(url: "/platform/category/getTreeCategory",method: Method.get);
    HttpEntity httpEntity = result as HttpEntity;
    RootCategory rootCategory = RootCategory.fromJson(httpEntity.oriData['data']);



    return rootCategory.children;
  }

  }
